package twu.shuhbam.library;


import org.junit.Test;
import twu.shubham.library.Library;

import static org.junit.Assert.assertEquals;

public class LibraryTests {


    Library Library = new Library();


    @Test
    public void WithCorrectDetailsPersonWillBeLoggedIn() throws Exception {

        assertEquals("You are logged in", Library.Login(1111112,"Ankit"));
    }

    @Test
    public void WithIncorrectDetailsPersonWillNotBeLoggedIn() throws Exception {

        assertEquals("Either Wrong library number or Password", Library.Login(111111,"Ankit"));
    }

    @Test
    public void TwoPersonWillNotBeLoggedInAtTheSameTime() throws Exception {

        Library.Login(1111111,"Amit") ;
        assertEquals("Already Logged in", Library.Login(1111112,"Ankit"));
    }

    @Test
    public void WithOutLoginBookWillNotBeReserved() throws Exception {


        assertEquals("Login First !!!", Library.reserveBook(1));
    }

    @Test
    public void AfterLoginAndWithCorrectBookNumberBookWillBeReserved() throws Exception {
        Library.Login(1111111,"Amit") ;
        assertEquals("Thank You, Your book has been reserved", Library.reserveBook(1));
    }

    @Test
    public void WithOutCorrectBookNumberBookWillNotBeReserved() throws Exception {

        Library.Login(1111111,"Amit") ;
        assertEquals("Sorry, this book is not available yet", Library.reserveBook(8));
    }

    @Test
    public void WithOutLoginMembershipDetailsWillNotBeAvailable() throws Exception {


        assertEquals("Login First !!!", Library.getMembershipDetail());
    }

    @Test
    public void AfterLoginMembershipDetailsWillBeAvailable() throws Exception {

        Library.Login(1111111,"Amit") ;
        assertEquals("Amit\tamit@gmail.com\t551122", Library.getMembershipDetail());
    }


}
